{% extends "base.html" %}
{% load static %}
{% block title %}学生信息{% endblock %}
{% block css %}
    <link href="{% static 'css/layui.css' %}" rel="stylesheet">
{% endblock %}
{% block content %}
    <div class="layui-container">
        <blockquote class="layui-elem-quote">
            <h1>学生信息</h1>
        </blockquote>
        {# 查询学生模块 #}
         <form style="float:left;"action="/getbyname/" method="get">
            <input placeholder="学生名" name="tName" id="tName">
            <input type="submit" class="layui-btn" value="搜索">&nbsp;&nbsp; &nbsp;&nbsp;
        </form>
        <form action="/getbygrade/" method="get">
            <select name="tGrade" id="tGrade" >
                        <option value="0">--选择班级--</option>
                        {%for grade in gradedata%}
                            <option value={{grade.grade_id}}>{{grade.name}}</option>
                        {% endfor %}
            </select>
             <input type="submit" class="layui-btn" value="搜索">
        </form>
        {# 显示所有学生模块 #}
        <table class="layui-table">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>照片</th>
            <th>学号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>修改</th>
            <th>删除</th>
        </tr>
      </thead>
      <tbody>
        {%for student in studentdata%}
            <tr>
                <td>
                    <img src="{{ student.image }}" height="50px">
                </td>
                <td>{{student.student_id}}</td>
                <td>{{student.name}}</td>
                <td>{{student.age}}</td>
                <td>{{student.sex}}</td>
                <td>
                    {# 修改学生模块 #}
                    <a href="/getbyid/{{ student.student_id }}" class="layui-btn layui-btn-normal">
                        <i class="layui-icon">&#xe642;</i>修改
                    </a>
                </td>
                <td>
                    {# 删除学生模块 #}
                    <a href="/delete_student/{{ student.student_id }}" class="layui-btn layui-btn-danger">
                        <i class="layui-icon">&#xe640;</i>删除
                    </a>
                </td>
            </tr>
        {%endfor%}

      </tbody>
        </table>

        {# 添加学生模块 #}
        <a href="/add_page/" class="layui-btn layui-btn-warm">
            <i class="layui-icon">&#xe654;</i> 添加
        </a>
    </div>
{% endblock %}